home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / os30 / gfx / animdemo.lha / asyncio.h < prev    next >
C/C++ Source or Header  |  1993-01-22  |  2KB  |  71 lines

  1. /*******************************************************************************
  2.  *
  3.  * (c) Copyright 1993 Commodore-Amiga, Inc.  All rights reserved.
  4.  *
  5.  * This software is provided as-is and is subject to change; no warranties
  6.  * are made.  All use is at your own risk.  No liability or responsibility
  7.  * is assumed.
  8.  *
  9.  ******************************************************************************/
  10.  
  11. #ifndef ASYNCIO_H
  12. #define ASYNCIO_H
  13.  
  14. /*****************************************************************************/
  15.  
  16.  
  17. #include <exec/types.h>
  18. #include <exec/ports.h>
  19. #include <dos/dos.h>
  20.  
  21.  
  22. /*****************************************************************************/
  23.  
  24.  
  25. struct AsyncFile
  26. {
  27.     BPTR                  af_File;
  28.     ULONG                 af_BlockSize;
  29.     struct MsgPort       *af_Handler;
  30.     APTR                  af_Offset;
  31.     LONG                  af_BytesLeft;
  32.     ULONG              af_BufferSize;
  33.     APTR              af_Buffers[2];
  34.     struct StandardPacket af_Packet;
  35.     struct MsgPort        af_PacketPort;
  36.     ULONG                 af_CurrentBuf;
  37.     ULONG                 af_SeekOffset;
  38.     UBYTE              af_PacketPending;
  39.     UBYTE              af_ReadMode;
  40. };
  41.  
  42.  
  43. /*****************************************************************************/
  44.  
  45.  
  46. #define MODE_READ   0  /* read an existing file                             */
  47. #define MODE_WRITE  1  /* create a new file, delete existing file if needed */
  48. #define MODE_APPEND 2  /* append to end of existing file, or create new     */
  49.  
  50. #define MODE_START   -1   /* relative to start of file         */
  51. #define MODE_CURRENT  0   /* relative to current file position */
  52. #define MODE_END      1   /* relative to end of file         */
  53.  
  54.  
  55. /*****************************************************************************/
  56.  
  57.  
  58. struct AsyncFile *OpenAsync(const STRPTR fileName, UBYTE accessMode, LONG bufferSize);
  59. LONG CloseAsync(struct AsyncFile *file);
  60. LONG ReadAsync(struct AsyncFile *file, APTR buffer, LONG numBytes);
  61. LONG ReadCharAsync(struct AsyncFile *file);
  62. LONG WriteAsync(struct AsyncFile *file, APTR buffer, LONG numBytes);
  63. LONG WriteCharAsync(struct AsyncFile *file, char ch);
  64. LONG SeekAsync(struct AsyncFile *file, LONG position, BYTE mode);
  65.  
  66.  
  67. /*****************************************************************************/
  68.  
  69.  
  70. #endif /* ASYNCIO_H */
  71.